package com.oragraph.data.instance;

import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Vector;

public class InstanceTypeManager {
	
	private static Hashtable<String,InstanceFactory> _instanceFactories;
	
	static {
		_instanceFactories=new Hashtable<String,InstanceFactory>();
	}
	
	public static void registerInstanceFactory(String instanceType, InstanceFactory factory) {
		_instanceFactories.put(instanceType, factory);
	}
	
	public static InstanceFactory getInstanceFactory(String instanceType) {
		return _instanceFactories.get(instanceType);
	}

	public static Vector<String> getInstanceTypes() {
		Vector<String> types=new Vector<String>();
		
		Enumeration<String> keys=_instanceFactories.keys();
		while (keys.hasMoreElements()) {
			types.add(keys.nextElement());
		}
		
		return types;
	}
}
